<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j">
<head>
<title>#{bundle.painelcurso}</title>
</head>
<body>
	<div id="accordion2">
		<rich:simpleTogglePanel label="#{bundle.painelcadcurso}"
			switchType="client">
			<div>
				<div>
					<h:form>
				#{bundle.painelnome}<br />
						<h:inputText required="true" id="nome" size="60"
							value="#{pCursoBean.nome}">
							<f:validator validatorId="chaveValidator" />
							<f:attribute name="tipo" value="Curso" />
						</h:inputText>
						<h:message for="nome"
							style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.painelch}<br />
						<h:inputText required="true" id="ch"
							value="#{pCursoBean.cargahoraria}">
							<f:validateLongRange minimum="1" />
						</h:inputText>
						<h:message for="ch"
							style="color: blue;font-weight: bold;margin-left: 10px;" />
						<br />
				#{bundle.paineldesc}<br />
						<h:inputTextarea value="#{pCursoBean.descricao}" rows="12"
							cols="70" id="desc"></h:inputTextarea>
						<br />
						<br />
						<h:commandButton value="#{bundle.painelcad}"
							action="#{pCursoBean.cadastrar}" />
					</h:form>
				</div>
			</div>
		</rich:simpleTogglePanel>
		<rich:simpleTogglePanel label="#{bundle.painelvercurso}"
			switchType="client">
			<div>
				<div>
					<h:form>
						<h:dataTable bgcolor="#F8F8FF" cellpadding="10px" width="100%"
							var="curso" rowClasses="tr_listapainel" id="dtpancur"
							styleClass="table_listapainel" headerClass="head_listacurso"
							value="#{pCursoBean.lista}">
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelnome}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{curso.nome}" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.painelch}</b>
									</h:outputText>
								</f:facet>
								<h:outputFormat value="#{curso.cargahoraria} hs" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>
										<b>#{bundle.paineldesc}</b>
									</h:outputText>
								</f:facet>
								<h:outputText value="#{curso.descricao}">
									<f:converter converterId="DescricaoConverter" />									
								</h:outputText>
								<h:outputLink value="#" id="link" rendered="#{curso.tamanhoDesc}">
        							 #{bundle.paineldescricaomais}
        							<rich:componentControl for="descCompleta" attachTo="link"
										operation="show" event="onclick" />
								</h:outputLink>
								<f:subview>
									<rich:modalPanel id="descCompleta" width="430" height="180">
										<f:facet name="header">
											<h:panelGroup>
												<h:outputText 
													value="#{bundle.paineldescricaocompleta} - #{curso.nome}" />												
											</h:panelGroup>
										</f:facet>
										<f:facet name="controls">
											<h:panelGroup>
												<h:outputLink value="#" id="hidelinkDesc">#{bundle.sair}</h:outputLink>
												<rich:componentControl for="descCompleta"
													attachTo="hidelinkDesc" operation="hide" event="onclick" />
											</h:panelGroup>
										</f:facet>
										#{curso.descricao}
									</rich:modalPanel>
								</f:subview>
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText>#{bundle.painelacoes}</h:outputText>
								</f:facet>
								<a4j:commandButton action="#{eCursoBean.carregar}"
									value="#{bundle.paineleditar}" id="atualCurso"
									oncomplete="Richfaces.showModalPanel('panelCurso')"
									reRender="nomeCur,chCur,descCur">
									<f:setPropertyActionListener value="#{curso}"
										target="#{eCursoBean.atual}" />
								</a4j:commandButton>
								<h:commandButton action="#{pCursoBean.deletar}"
									value="#{bundle.painelexcluir}"
									onclick="return confirm('#{bundle.paineloconfirmexcluircurso}');">
									<f:setPropertyActionListener value="#{curso.nome}"
										target="#{pCursoBean.nomeDel}" />
								</h:commandButton>
							</h:column>
						</h:dataTable>
					</h:form>
					<f:subview id="editacurso">
						<ui:include src="/editarcurso.xhtml" />
					</f:subview>
				</div>
			</div>
		</rich:simpleTogglePanel>
	</div>
</body>
</html>